<!DOCTYPE html>
<html lang="en">

<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
</head>

<body>
    <button id="btn">提交</button>
    <script>
        let btn = document.getElementById('btn');
        function handle(e) {
            console.log(e);

            console.log("向后端发送请求");
            console.log(this);

        }

        btn.addEventListener('click', debunce(handle, 1000))

        function debunce(handle, wait) {
            var timer = null;
            // 闭包
            return function (...args) {
                // 清除定时器
                clearTimeout(timer)
                timer = setTimeout(() => {
                    handle.call(this, ...args)
                }, wait)
            }
        }
    </script>
</body>

</html>